# CMakeList.txt: MyCommon 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)
project(json4Vector)

file(GLOB_RECURSE DEMO_INCLUDE 
	${PROJECT_SOURCE_DIR}/include/*.h 
	${PROJECT_SOURCE_DIR}/include/*.hpp
)

file(GLOB_RECURSE DEMO_SRC 
	# ${PROJECT_SOURCE_DIR}/src/*.cpp 
	# ${PROJECT_SOURCE_DIR}/src/*.c
	# ${PROJECT_SOURCE_DIR}/*.cpp
	# ${PROJECT_SOURCE_DIR}/*.c
	${PROJECT_NAME}.cpp
)

message(WARNING ${DEMO_SRC})

option(IS_WINDOWS OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	set(IS_WINDOWS ON)
endif()

# 添加三方库依赖
if(IS_WINDOWS)
    message(STATUS "Configuring on/for Windows")
	#message(FATAL_ERROR "Configuring on/for Windows")
	add_definitions(-D_WINDOWS)

#添加Eigen头文件
	set(EIGEN_INCLUDE_DIRS $ENV{PCL_ROOT}/3rdParty/Eigen/eigen3)

else()
	# 假设是Linux

	#添加Eigen头文件
	set(EIGEN_INCLUDE_DIRS /usr/include/eigen3)

	find_package(fmt REQUIRED)
	
endif()

# 添加MYSDK依赖
file(TO_CMAKE_PATH $ENV{MYSDK_ROOT} MYSDK_ROOT) 
list(APPEND CMAKE_PREFIX_PATH ${MYSDK_ROOT}) 

set(MYSDK_INCLUDE_DIRS ${MYSDK_ROOT}/include)
set(MYSDK_LIBRARY_DIRS ${MYSDK_ROOT}/lib)

# 仅添加nlohmann库
set(JSON_ROOT ${MYSDK_ROOT}/3rdParty/nlohmann_json)

message(WARNING ${PROJECT_SOURCE_DIR}/include)
include_directories(
	${PROJECT_SOURCE_DIR}/include/
	${EIGEN_INCLUDE_DIRS}
	${JSON_ROOT}
)


# add_library(${PROJECT_NAME} SHARED)
add_executable(${PROJECT_NAME} ${DEMO_SRC})

target_link_libraries(${PROJECT_NAME} 
	fmt::fmt
)

# target_link_directories(${PROJECT_NAME}
# 	PUBLIC
# 	${PROJECT_SOURCE_DIR}/include
# )

# target_sources(${PROJECT_NAME}
# 	PRIVATE
# 	${DEMO_INCLUDE}
# 	${DEMO_SRC}
	
# )
